const downapp = document.querySelector(".downapp");
const qrCode = document.querySelector(".vivo-app-qrCode");
const headLoginBox = document.querySelector(".head-login-box");
const userLists = document.querySelector(".head-user-lists");
//首页右上角下载APP事件
downapp.addEventListener("mouseover", function () {
  qrCode.style.display = "block";
});

downapp.addEventListener("mouseout", function () {
  qrCode.style.display = "none";
});

//首页右上角个人中心事件
headLoginBox.addEventListener("mouseover", function () {
  userLists.style.display = "block";
});

headLoginBox.addEventListener("mouseout", function () {
  userLists.style.display = "none";
});

//搜索框
const searchBtn = document.querySelector(".head-search-confirm");
const searchBox = document.querySelector(".head-search-wrap");
const closeBtn = document.querySelector(".head-search-close");
searchBtn.addEventListener("click", function () {
  searchBox.style.height = "402px";
  searchBox.style.opacity = "1";
  searchBtn.style.display = "none";
  closeBtn.style.display = "block";
});
closeBtn.addEventListener("click", function () {
  searchBox.style.height = "0px";
  searchBox.style.opacity = "0";
  searchBtn.style.display = "block";
  closeBtn.style.display = "none";
});

//菜单下拉
const headMenu = document.querySelectorAll(".head-series");
const headProductsMaskNew = document.querySelector(".head-products-mask-new");
const headMenuSeries = document.querySelector(".head-menu-series");
const headSeriesProducts = document.querySelector(".head-series-products");

for (let i = 0; i < headMenu.length; i++) {
  headMenu[i].addEventListener("mouseover", function () {
    headProductsMaskNew.style.top = "0";
    headMenuSeries.style.height = "420px";
    headSeriesProducts.style.opacity = "1";
    headSeriesProducts.style.top = "0";
  });

  headMenu[i].addEventListener("mouseout", function () {
    headProductsMaskNew.style.top = "-488px";
    headMenuSeries.style.height = "0";
    headSeriesProducts.style.opacity = "0";
    headSeriesProducts.style.top = "-546px";
  });
}

headMenuSeries.addEventListener("mouseover", function () {
  headMenuSeries.style.height = "420px";
  headProductsMaskNew.style.top = "0";
  headSeriesProducts.style.opacity = "1";
  headSeriesProducts.style.top = "0";
});
headMenuSeries.addEventListener("mouseout", function () {
  headMenuSeries.style.height = "0px";
  headProductsMaskNew.style.top = "-488px";
  headSeriesProducts.style.opacity = "0";
  headSeriesProducts.style.top = "-546px";
});